package top.xiaozhaobk.xiaofenshu.note.biz.domain.mapper;

import top.xiaozhaobk.xiaofenshu.note.biz.domain.dataobject.NoteDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 * 笔记表 Mapper 接口
 * </p>
 *
 * @author xiaozhao
 * @since 2025-01-03
 */
public interface NoteDOMapper extends BaseMapper<NoteDO> {
    /**
     * 插入笔记
     * @param noteDO
     * @return
     */
    void insertNote(NoteDO noteDO);

    /**
     * 根据主键查询笔记
     * @param id
     * @return
     */
    NoteDO selectByPrimaryKey(Long id);

    /**
     * 更新笔记
     * @param noteDO
     */
    void updateByPrimaryKey(NoteDO noteDO);

    /**
     * 删除笔记
     * @param noteDO
     */
    int updateByPrimaryKeySelective(NoteDO noteDO);

    /**
     * 更新笔记可见性
     * @param noteDO
     */
    int updateVisibleOnlyMe(NoteDO noteDO);

    /**
     * 更新笔记置顶状态
     * @param noteDO
     */
    int updateIsTop(NoteDO noteDO);

    /**
     * 查询笔记是否存在
     * @param noteId
     * @return
     */
    int selectCountByNoteId(Long noteId);
}
